<?php
	include('config.php');
	error_reporting(E_ALL);
	if (version_compare(phpversion(), '5.1.0', '<') == true) { 	
		die ('PHP5.1 Only'); 
	}
	// Constants:
	define('DS', DIRECTORY_SEPARATOR);
	// Get site path
	$site_path = realpath(dirname(__FILE__) . DS . '..' . DS) . DS;
	define ('SITE_PATH', $site_path);
	define('PATH_SMARTY', SITE_PATH.'libs'.DS.'Smarty');
	define('PATH_SMARTY_TEMPLATE', SITE_PATH.'templates');
	define('PATH_SMARTY_COMPILED', SITE_PATH.'tmp'.DS. 'templates_c');
	
	// For loading classes
    function __autoload($class_name) 
    {
        //modified to auto load class in model
        $check = explode('_', $class_name);
        $path_to_class='';
        if((count($check)>1)&&(strtolower($check[0])=='model')) {
            $path_to_class='models'.DS.$check[1];
            $filename = str_replace(array('Model_','model_'),'',$class_name). '.php';
        }
        else{
            $path_to_class='classes';
            $filename = strtolower($class_name) . '.php';
        }
        $file = SITE_PATH.$path_to_class.DS. $filename;
        if (file_exists($file) == false) {
            return false;
        }
        include ($file);
    }
	
	$registry = new Registry();
	Application::loadParameters($applicationParameters);

?>